def collatz(number):
      if number % 2 == 0:
         return number // 2
      elif number % 2 ==1:
         return 3*number + 1
      else:
         print("Error")

print("请输入一个数:",end = '')
while True:
    try:
        result = int(input())
        break
    except ValueError:
        print("输入的不是整数")

while True:
        print(result)
        result = collatz(result)
        if result == 1:
             break
print(str(result))
